package com.crm.controller.common;

import cn.hutool.captcha.ShearCaptcha;
import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.generator.MathGenerator;

public class MathCaptchaExample {
    public static void main(String[] args) {
        ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 100);
        // 设置为数学表达式生成器
        captcha.setGenerator(new MathGenerator());
        captcha.createCode(); // 重新生成验证码

        System.out.println("验证码答案: " + captcha.getCode()); // 例如 "6"
        String code = captcha.getCode();
        System.out.println(code);
        System.out.println(captcha.getImageBase64());
    }
}
